<template>
  <div>
    <el-breadcrumb separator="/" style="padding-left: 10px;padding-bottom: 10px;font-size:12px; ">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>物资管理</el-breadcrumb-item>
      <el-breadcrumb-item>入库记录</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-form :inline="true" style="margin-left: 10px" ref="formInline" :model="formInline" class="demo-form-inline">
        <el-form-item label="类型">
          <el-select v-model="formInline.type" placeholder="请选择">
            <el-option
              v-for="item in cities"
              :key="item.value"
              :label="item.label"
              :value="item.value">
              <span style="float: left">{{ item.label }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="单号" style="margin-right: 30px"  label-width="70px">
          <el-input clearable v-model="formInline.inNum" placeholder="请输入入库单查询"></el-input>
        </el-form-item>
        <el-select v-model="formInline.status" style="margin-right:20px " placeholder="请选择状态">
          <el-option
            v-for="item in statuss"
            :key="item.value"
            :label="item.label"
            :value="item.value">
            <span style="float: left">{{ item.label }}</span>
          </el-option>
        </el-select>
<!--        时间-->
        <el-date-picker
          v-model="formInline.dateTime"
          type="datetimerange"
          :picker-options="pickerOptions"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          align="right"
          style="width: 290px">
        </el-date-picker>
        <el-button style="margin-left: 20px;width: 80px" type="primary" icon="el-icon-search">查询</el-button>
        <el-form-item>
          <el-button icon="el-icon-refresh" @click="resetForm('formInline')" type="reset">重置</el-button>
          <el-button type="success" icon="el-icon-plus" @click="addStocks">添加</el-button>
          <el-button type="warning" icon="el-icon-download">导出</el-button>
        </el-form-item>
      </el-form>
      <!--    表格 （表格prop名不太对，自己调整）-->
      <el-table
        :data="tableData"
        border
        style="width: 100%">
        <el-table-column
          prop="id"
          label="#"
          width="90">
        </el-table-column>
        <el-table-column
          prop="inNum"
          label="入库单号"
          width="170">
        </el-table-column>
        <el-table-column
          prop="type"
          label="物资类型"
          width="120">
        </el-table-column>
        <el-table-column
          prop="productNumber"
          label="数量"
          width="120">
        </el-table-column>
        <el-table-column
          prop="phone"
          label="联系电话"
          width="100">
        </el-table-column>
        <el-table-column
          prop="status"
          label="状态"
          width="120">
        </el-table-column>
        <el-table-column
          prop="operator"
          label="操作员"
          width="120">
        </el-table-column>
        <el-table-column
          prop="address"
          label="物资提供方"
          width="120">
        </el-table-column>
        <el-table-column
          prop="zip"
          label="入库时间"
          width="200">
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          width="200">
          <template slot-scope="scope">
            <el-button @click="dialogFormVisible=true" type="text" size="small"><span class="el-icon-view"></span>明细</el-button>
            <el-button type="text" size="small"><span class="el-icon-delete"></span>回收</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--      分页-->
      <el-pagination
        style="padding-top: 15px"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400">
      </el-pagination>
      <!-- 查看明细-->
      <el-dialog title="入库明细" style="height: 800px" :visible.sync="dialogFormVisible">
        <div class="dialog-table-div">
        <ul class="dialog-table-ul" style="list-style: none;">
          <li>省区市:<span>北京市/市辖区/东城区</span></li>
          <li>具体位置:<span>4b4</span></li>
          <li>联系人:<span>川普</span></li>
          <li>电话:<span>13013013013</span></li>
        </ul>
        </div>
        <div style="margin-top: 10px">
          <el-steps :active="3" simple>
            <el-step title="步骤 1" icon="el-icon-circle-check"></el-step>
            <el-step title="步骤 2" icon="el-icon-circle-check"></el-step>
            <el-step title="步骤 3" icon="el-icon-circle-check"></el-step>
          </el-steps>
        </div>
        <el-table
          :data="inDetailInfo "
          border
          style="width: 100%;margin-top: 20px;">
          <el-table-column
            prop="date"
            label="日期"
            width="90">
          </el-table-column>
          <el-table-column
            prop="name"
            label="姓名"
            width="80">
          </el-table-column>
          <el-table-column
            prop="address"
            label="地址"
          width="130">
          </el-table-column>
          <el-table-column
            prop="date"
            label="日期"
            width="100">
          </el-table-column>
          <el-table-column
            prop="name"
            label="姓名"
            width="80">
          </el-table-column>
          <el-table-column
            prop="address"
            label="地址">
          </el-table-column>
        </el-table>
        <el-pagination
          background
          layout="prev, pager, next"
          :total="1"
        style="margin-top: 30px">
        </el-pagination>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
  export default {
    name: 'InStocks',
    data() {
      return {
        dialogFormVisible:false,
        insertFrom: {
          name:null,
          region:null
        },
        formInline: {
          inNum: '',
          type:'',
          status:'',
          dateTime: ''
        },
        // 页码
        currentPage4: 1,
        // 类型下拉框
        cities: [
          {
          value: '1',
          label: '捐赠'
        }, {
          value: '2',
          label: '下拨'
        }, {
          value: '3',
          label: '采购'
        }, {
          value: '4',
          label: '借用'
        }],
        //状态下拉框
        statuss:[
          {
            value:'1',
            label:'回收站'
          },{
          value:'2',
            label:'已入库'
          },{
            value:'3',
            label:'待审核'
          }
        ],
        // 用户信息
        tableData: [
          {
          date: '2016-05-02',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '2016-05-04',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1517 弄',
          zip: 200333
        }, {
          date: '2016-05-01',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1519 弄',
          zip: 200333
        }, {
          date: '2016-05-03',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1516 弄',
          zip: 200333
        }],
        // 时间输入框设置
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
        inDetailInfo:[
          {
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }
        ]
      }
    },
    methods: {
      onSubmit() {
        console.log('submit!');
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
      addStocks(){
        this.$router.push("/inStocks/addStocks");
      }
    }
  }
</script>

<style scoped>
  .dialog-table-div{
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    height: 90px;
  }
  .dialog-table-ul{
    position: relative;
    top: 40%;
  }
.dialog-table-ul li{
  display: inline-block;
  margin-left: 40px;
}
  .dialog-table-ul li span{
    color:#409EFF;
    background-color: lightskyblue;
    border-radius: 3px;
  }
</style>
